Skip to content

fix: type listAwayStatusReasons response as list wrapper#558

Open
fern-support wants to merge 1 commit into
mainfrom
fix/away-status-reasons-list-response-type
Open

fix: type listAwayStatusReasons response as list wrapper#558
fern-support wants to merge 1 commit into
mainfrom
fix/away-status-reasons-list-response-type

Conversation

@fern-support

Copy link
Copy Markdown
Collaborator

What changed

GET /away_status_reasons (listAwayStatusReasons) had its 200 response modeled as a bare array, AwayStatusReason[]. The endpoint actually returns Intercom's standard list wrapper:

{ "type": "list", "data": [ /* AwayStatusReason objects */ ] }

Because Fern generates from the spec, every SDK cast the wrapper object straight to AwayStatusReason[], so the typed return value never matched the runtime value (e.g. response[0] / response.map(...) silently break).

This PR overrides the response schema to the list wrapper in both Fern override files (the descriptions/ specs are a generated artifact, so the fix belongs in the override layer):

  • fern/openapi-overrides.yml — stable spec (drives the 2.14 SDK source)
  • fern/preview-openapi-overrides.yml — preview namespace (drives the 0 source)

Which API versions are affected

The endpoint exists in 2.14, 2.15, and 0 (preview). The override layer applies to the two specs that drive SDK generation: stable (2.14) and preview (0).

Verification

Preview-generated the TypeScript SDK locally with the override:

export interface ListAwayStatusReasonsResponse {
    type: string;
    data: Intercom.AwayStatusReason[];
}
// listAwayStatusReasons() -> HttpResponsePromise<Intercom.ListAwayStatusReasonsResponse>

The regenerated wire test now mocks and asserts { type: "list", data: [...] }. fern check reports no new errors versus main.

Note

This is technically a breaking change to the generated return type, though the SDK was already incorrect at runtime. Worth sequencing the SDK releases as a major bump.

Fixes intercom/intercom-node#520
Linear: FER-11398

The GET /away_status_reasons 200 response is modeled as a bare
AwayStatusReason[], but the API actually returns the standard list
wrapper { type: "list", data: AwayStatusReason[] }. This made the
generated SDKs cast the wrapper object to an array, so the typed return
value never matched reality at runtime.

Override the response schema in both the stable and preview override
files to the list wrapper. Verified by preview-generating the TS SDK:
listAwayStatusReasons now returns ListAwayStatusReasonsResponse
({ type, data }) and the regenerated wire test asserts the wrapper.

Fixes intercom/intercom-node#520
dan0505 added a commit that referenced this pull request Jun 29, 2026
GET /away_status_reasons returns Intercom's standard list envelope
{ "type": "list", "data": [...] }, but the 200 response was modeled as a
bare array of away_status_reason objects. Add an away_status_reason_list
component (matching the tag_list/brand_list convention) and point the 200
response at it, across the versions that expose the endpoint: 2.14, 2.15,
and 0 (Preview).

Verified against the monolith: Api::V3::AwayStatusReasonsController#index
renders via AwayStatusReasonListResponse, which emits { type: "list", data }.
fern check reports no new errors or warnings vs main.

Refs intercom/intercom-node#520, FER-11398, #558.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong type for listAwayStatusReasons

2 participants